<%@ page language="java" %>

<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>

			<div id="panel" class="layout">
				<div class="categ_left">
					<h3><a href="control?cmd=accueil">Accueil</a></h3>
					<br/>
                    <h3>Categories</h3>
					<ul>
					<c:forEach items="${sessionScope.lesCategories}" var="categ">
						<li><a href=control?cmd=pageCateg&idCateg=${categ.id}&tri=Prix>${categ.libelle}</a></li>
					</c:forEach>
					</ul>
				</div>
				<br/>
				<h3>Votre Panier</h3>
				<br/>
				<div id="panierLeft">
					<c:set var="panier" value="${sessionScope.Panier}"/>
					<c:if test="${empty panier.lesPanierItems or panier==null}">
						<div id='paniervide'>Votre Panier est vide</div>
					</c:if>
					<c:if test="${not empty panier.lesPanierItems}">
						<c:forEach items="${panier.lesPanierItems}" var="pi">
						    <div id='panierItemLeft'>
						    <img id='prod' src='/ProjetCAR/produits/images/${pi.prod.id}.png' width='30' height='80' alt='' />
						    <div id='panierItemLeftTitle'>${pi.prod.libelle}</div>
						    <div id='panierItemLeftPrice'>P.U. : ${pi.prod.prixToString}&#128; TTC</div>
						    <div id='panierItemLeftQte'>Qte : ${pi.quantite}</div>
						    <img id='separator' src='/ProjetCAR/css/img/separator.png' width='160' height='2'/>
						    </div><br/>
						</c:forEach>
						<div id='panierLeftPrixTotal'>Prix total : ${panier.prixTotal}&#128; TTC</div>
					</c:if>
					<div id='links'>
						<a href="control?cmd=modifierPanier">Modifier votre panier</a>
						<br/>
						<a href="control?cmd=passerCommande">Passer commande</a>
					</div>
				</div> <!--On ferme le div panierLeft-->
				<br/>
				
				<h3>Espace Client</h3>
				<br/>
				<div id="espaceClient">
					    <jsp:useBean id="connexion" class="beans.ConnexionBean" scope="session"/>	
						<jsp:setProperty name="connexion" property="*"/>
						<c:set var="c" value="${sessionScope.leClient}"/>				
						<c:if test="${c!=null}">
							<jsp:setProperty name='connexion' property='mail' value=""/>
							<jsp:setProperty name='connexion' property='password' value=""/>
							<div id="bienvenue">
								Bienvenue ${c.prenom} ${c.nom} <br/>
								Vous &#234;tes connect&#233;(e)<br/><br/>
								<a href='control?cmd=deconnexion'>Deconnexion</a>
								<br/>
								<a href='control?cmd=voirInfosClient'>Votre espace client</a>
							</div>
						</c:if>
						<c:if test="${c==null}">
							<form method="get" action="control">
							<input type="hidden" name="cmd" value="validerConnexion"/>
							<TABLE BORDER=0>
							<TR>
								<TD><label for="mail">E-mail :</label></TD>
								<TD><input Type="text" id="mail" name="mail" size="14" value="<jsp:getProperty name='connexion' property='mail'/>"/></TD>
							</TR>
							<TR>
								<TD><label for="password">Password :</label></TD>
								<TD><input Type="password" id="password" name="password" size="14" value="<jsp:getProperty name='connexion' property='password'/>"/></TD>
							</TR>
							<TR>
							<TD colspan=2><INPUT type="submit" value="Envoyer"></TD>
							</TR>
							</TABLE>
							</form>
							<!--on affiche le msg d'erreur (pas la premiere fois, car null)-->
							<c:set var="erreur" value="${requestScope.erreurmsg}"/>				
							<c:if test="${erreur!=null}">
							    <div id='erreurmsg'>${erreur}</div>
							</c:if>
						<a href='control?cmd=creerCompte'>Cr&#233;er un compte</a>
					    </c:if>
				</div> <!--On ferme le div espaceClient-->
			</div> <!--on ferme le div panel-->